package org.particlethink.handler;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;
import org.apache.ibatis.type.MappedTypes;
import org.particlethink.model.Acceptance;

import java.util.List;

//@MappedTypes(Acceptance.AcceptanceGoodsInfo.class)
//public class ArrayAcceptanceGoodsInfoTypeHandler extends JsonTypeHandler<List<Acceptance.AcceptanceGoodsInfo>> {
//    @Override
//    List<Acceptance.AcceptanceGoodsInfo> jsonToJava(String jsonStr) throws JsonProcessingException {
//        if (jsonStr == null) {
//            return null;
//        }
//        ObjectMapper objectMapper = new ObjectMapper();
//        CollectionType collectionType = objectMapper.getTypeFactory().constructCollectionType(List.class, Acceptance.AcceptanceGoodsInfo.class);
//        return objectMapper.readValue(jsonStr, collectionType);
//    }
//}
